package ProjectoX;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class TraductorDeArchivo {
	
	protected char [] [] MatrizDatos;
	protected File archivo;
	protected FileReader fr;
	protected BufferedReader bf;
	final protected int NFilas = 10;
	final protected int NColumnas = 250;
	
	
	public TraductorDeArchivo () {
		try {
			//URL url = getClass().getClassLoader().getResource("res/Datos/Datos.txt");
			//archivo = new File(url.getPath());
			InputStream is = getClass().getResourceAsStream("/res/Datos/Datos.txt");
			bf = new BufferedReader(new InputStreamReader(is));
            //fr = new FileReader(archivo);
            //bf = new BufferedReader (fr);
			MatrizDatos = new char [NColumnas][NFilas];
			int i = 0;
			int j;
			while (i<NColumnas) {
				j = 0;
				while (j<NFilas) {
					char a = (char)bf.read();
					if ((a!='\r') &&(a!='\n')) {
						MatrizDatos [i][j] = a;
						j++;
					}
				}
				i++;
			}
		}
        catch (IOException e) {
        	System.out.println("No encontrado");
        } 
        finally {
            try { 
               bf.close();
            }
            catch (IOException e) {
            }
        }
	}
	
	public char [] [] getMatriz() {
		return MatrizDatos;
	}
	
}
